package 实训训练;

import java.util.Scanner;


public class demo1 {
    public static String userName="";
    public static String passWord="";
    static Scanner scanner =new Scanner(System.in);
    public static void main(String[] args) {


        while(true){
            System.out.println("************1.注册**2.登录**3退出");
            System.out.println("请输入你想操作的数字:");
            int x=scanner.nextInt();
            switch (x){
                case 1:
                    zc();
                    break;

                case 2:login(userName,passWord);
                break;

                case 3:System.exit(0);

            }


        }
    }
    public static void zc(){
        System.out.println("请输入用户名");
        String s = scanner.next();
        userName=s;
        System.out.println("请输入密码");
        String s3 = scanner.next();
        passWord=s3;
        System.out.println("注册成功");

    }
    public static void login(String s,String ss){
        System.out.println("请输入用户名:");
        String s1=scanner.next();
        System.out.println("请输入密码:");
        String s2=scanner.next();
        if (s1.equals(userName)&&s2.equals(passWord)){
            System.out.println("登录成功");
        }else if (!s1.equals(userName)){
            System.out.println("用户名输入错误,登录失败");

        }else if (!s1.equals(passWord)) {
            System.out.println("密码输入错误,登录失败");

        };
    }

}
